home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / OS.java < prev    next >
Text File  |  1998-08-21  |  2KB  |  104 lines

  1. package symantec.itools.lang;
  2.  
  3. //     02/15/97    RKM    Added isSolaris
  4. //  10/16/97    DS  Added isCaseSensitive
  5.  
  6. /**
  7.  * This class identifies the operating system that a program is running under.
  8.  * <p>
  9.  * It does not need to be instantiated by the user.
  10.  *
  11.  * @version 1.0, Nov 26, 1996
  12.  *
  13.  * @author    Symantec
  14.  */
  15. public final class OS
  16. {
  17.     private static boolean isWindows95 = false;
  18.     private static boolean isWindowsNT = false;
  19.     private static boolean isMacintosh = false;
  20.     private static boolean isSolaris   = false;
  21.     private static boolean isCaseSensitive = false;
  22.  
  23.     static
  24.     {
  25.         String s;
  26.  
  27.         s = System.getProperty("os.name");
  28.  
  29.         if(s.equals("Windows NT"))
  30.         {
  31.             isWindowsNT = true;
  32.         }
  33.         else if(s.equals("Windows 95"))
  34.         {
  35.             isWindows95 = true;
  36.         }
  37.         else if (s.equals("Macintosh") ||
  38.                  s.equals("macos") ||        //Applet Viewer
  39.                  s.equals("Mac OS") ||        //Netscape
  40.                  s.equals("MacOS"))            //Internet Explorer
  41.         {
  42.             isMacintosh = true;
  43.         }
  44.         else if (s.equals("SunOS") ||
  45.                  s.equals("Solaris"))
  46.         {
  47.             isSolaris       = true;
  48.             isCaseSensitive = true;
  49.         }
  50.     }
  51.  
  52.     private OS()
  53.     {
  54.     }
  55.  
  56.     /**
  57.      * Returns true if running under the Windows 95 or Windows NT operating system.
  58.      */
  59.     public static boolean isWindows()
  60.     {
  61.         return (isWindows95() || isWindowsNT());
  62.     }
  63.  
  64.     /**
  65.      * Returns true if running under the Windows 95 operating system.
  66.      */
  67.     public static boolean isWindows95()
  68.     {
  69.         return (isWindows95);
  70.     }
  71.  
  72.     /**
  73.      * Returns true if running under the Windows NT operating system.
  74.      */
  75.     public static boolean isWindowsNT()
  76.     {
  77.         return (isWindowsNT);
  78.     }
  79.  
  80.     /**
  81.      * Returns true if running under the Macintosh operating system.
  82.      */
  83.     public static boolean isMacintosh()
  84.     {
  85.         return (isMacintosh);
  86.     }
  87.  
  88.     /**
  89.      * Returns true if running under the Solaris operating system.
  90.      */
  91.     public static boolean isSolaris()
  92.     {
  93.         return (isSolaris);
  94.     }
  95.          
  96.     /**
  97.     * Returns true if file system is case sensitive.
  98.     */
  99.     public static boolean isCaseSensitive()
  100.     {
  101.         return (isCaseSensitive);
  102.     }
  103. }
  104.